3.2.40 \(\int \frac {c+d x}{a-a \cos (e+f x)} \, dx\) [140]

Optimal. Leaf size=50 \[ -\frac {(c+d x) \cot \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}+\frac {2 d \log \left (\sin \left (\frac {e}{2}+\frac {f x}{2}\right )\right )}{a f^2} \]

[Out]

-(d*x+c)*cot(1/2*f*x+1/2*e)/a/f+2*d*ln(sin(1/2*f*x+1/2*e))/a/f^2

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 50, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3399, 4269, 3556} \begin {gather*} \frac {2 d \log \left (\sin \left (\frac {e}{2}+\frac {f x}{2}\right )\right )}{a f^2}-\frac {(c+d x) \cot \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*x)/(a - a*Cos[e + f*x]),x]

[Out]

-(((c + d*x)*Cot[e/2 + (f*x)/2])/(a*f)) + (2*d*Log[Sin[e/2 + (f*x)/2]])/(a*f^2)

Rule 3399

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[(2*a)^n, Int[(c
 + d*x)^m*Sin[(1/2)*(e + Pi*(a/(2*b))) + f*(x/2)]^(2*n), x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && EqQ[a^2
- b^2, 0] && IntegerQ[n] && (GtQ[n, 0] || IGtQ[m, 0])

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 4269

Int[csc[(e_.) + (f_.)*(x_)]^2*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[(-(c + d*x)^m)*(Cot[e + f*x]/f), x
] + Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Cot[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rubi steps

\begin {align*} \int \frac {c+d x}{a-a \cos (e+f x)} \, dx &=\frac {\int (c+d x) \csc ^2\left (\frac {e}{2}+\frac {f x}{2}\right ) \, dx}{2 a}\\ &=-\frac {(c+d x) \cot \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}+\frac {d \int \cot \left (\frac {e}{2}+\frac {f x}{2}\right ) \, dx}{a f}\\ &=-\frac {(c+d x) \cot \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}+\frac {2 d \log \left (\sin \left (\frac {e}{2}+\frac {f x}{2}\right )\right )}{a f^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.15, size = 57, normalized size = 1.14 \begin {gather*} \frac {-4 d \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right ) \sin ^2\left (\frac {1}{2} (e+f x)\right )+f (c+d x) \sin (e+f x)}{a f^2 (-1+\cos (e+f x))} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x)/(a - a*Cos[e + f*x]),x]

[Out]

(-4*d*Log[Sin[(e + f*x)/2]]*Sin[(e + f*x)/2]^2 + f*(c + d*x)*Sin[e + f*x])/(a*f^2*(-1 + Cos[e + f*x]))

________________________________________________________________________________________

Maple [C] Result contains complex when optimal does not.
time = 0.09, size = 72, normalized size = 1.44

method result size
risch \(-\frac {2 i d x}{a f}-\frac {2 i d e}{a \,f^{2}}-\frac {2 i \left (d x +c \right )}{f a \left ({\mathrm e}^{i \left (f x +e \right )}-1\right )}+\frac {2 d \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right )}{a \,f^{2}}\) \(72\)
norman \(\frac {-\frac {c}{a f}-\frac {d x}{a f}}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )}+\frac {2 d \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{a \,f^{2}}-\frac {d \ln \left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{a \,f^{2}}\) \(76\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)/(a-a*cos(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

-2*I*d/a/f*x-2*I*d/a/f^2*e-2*I*(d*x+c)/f/a/(exp(I*(f*x+e))-1)+2*d/a/f^2*ln(exp(I*(f*x+e))-1)

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 176 vs. \(2 (44) = 88\).
time = 0.28, size = 176, normalized size = 3.52 \begin {gather*} \frac {\frac {{\left ({\left (\cos \left (f x + e\right )^{2} + \sin \left (f x + e\right )^{2} - 2 \, \cos \left (f x + e\right ) + 1\right )} \log \left (\cos \left (f x + e\right )^{2} + \sin \left (f x + e\right )^{2} - 2 \, \cos \left (f x + e\right ) + 1\right ) - 2 \, {\left (f x + e\right )} \sin \left (f x + e\right )\right )} d}{a f \cos \left (f x + e\right )^{2} + a f \sin \left (f x + e\right )^{2} - 2 \, a f \cos \left (f x + e\right ) + a f} - \frac {c {\left (\cos \left (f x + e\right ) + 1\right )}}{a \sin \left (f x + e\right )} + \frac {d {\left (\cos \left (f x + e\right ) + 1\right )} e}{a f \sin \left (f x + e\right )}}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)/(a-a*cos(f*x+e)),x, algorithm="maxima")

[Out]

(((cos(f*x + e)^2 + sin(f*x + e)^2 - 2*cos(f*x + e) + 1)*log(cos(f*x + e)^2 + sin(f*x + e)^2 - 2*cos(f*x + e)
+ 1) - 2*(f*x + e)*sin(f*x + e))*d/(a*f*cos(f*x + e)^2 + a*f*sin(f*x + e)^2 - 2*a*f*cos(f*x + e) + a*f) - c*(c
os(f*x + e) + 1)/(a*sin(f*x + e)) + d*(cos(f*x + e) + 1)*e/(a*f*sin(f*x + e)))/f

________________________________________________________________________________________

Fricas [A]
time = 0.40, size = 63, normalized size = 1.26 \begin {gather*} -\frac {d f x - d \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) \sin \left (f x + e\right ) + c f + {\left (d f x + c f\right )} \cos \left (f x + e\right )}{a f^{2} \sin \left (f x + e\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)/(a-a*cos(f*x+e)),x, algorithm="fricas")

[Out]

-(d*f*x - d*log(-1/2*cos(f*x + e) + 1/2)*sin(f*x + e) + c*f + (d*f*x + c*f)*cos(f*x + e))/(a*f^2*sin(f*x + e))

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 90 vs. \(2 (39) = 78\).
time = 0.39, size = 90, normalized size = 1.80 \begin {gather*} \begin {cases} - \frac {c}{a f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )}} - \frac {d x}{a f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )}} - \frac {d \log {\left (\tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + 1 \right )}}{a f^{2}} + \frac {2 d \log {\left (\tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} \right )}}{a f^{2}} & \text {for}\: f \neq 0 \\\frac {c x + \frac {d x^{2}}{2}}{- a \cos {\left (e \right )} + a} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)/(a-a*cos(f*x+e)),x)

[Out]

Piecewise((-c/(a*f*tan(e/2 + f*x/2)) - d*x/(a*f*tan(e/2 + f*x/2)) - d*log(tan(e/2 + f*x/2)**2 + 1)/(a*f**2) +
2*d*log(tan(e/2 + f*x/2))/(a*f**2), Ne(f, 0)), ((c*x + d*x**2/2)/(-a*cos(e) + a), True))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 229 vs. \(2 (44) = 88\).
time = 0.50, size = 229, normalized size = 4.58 \begin {gather*} \frac {d f x \tan \left (\frac {1}{2} \, f x\right ) \tan \left (\frac {1}{2} \, e\right ) + c f \tan \left (\frac {1}{2} \, f x\right ) \tan \left (\frac {1}{2} \, e\right ) - d f x + d \log \left (\frac {4 \, {\left (\tan \left (\frac {1}{2} \, f x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, f x\right )^{3} \tan \left (\frac {1}{2} \, e\right ) + \tan \left (\frac {1}{2} \, f x\right )^{2} \tan \left (\frac {1}{2} \, e\right )^{2} + \tan \left (\frac {1}{2} \, f x\right )^{2} + 2 \, \tan \left (\frac {1}{2} \, f x\right ) \tan \left (\frac {1}{2} \, e\right ) + \tan \left (\frac {1}{2} \, e\right )^{2}\right )}}{\tan \left (\frac {1}{2} \, e\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, f x\right ) + d \log \left (\frac {4 \, {\left (\tan \left (\frac {1}{2} \, f x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, f x\right )^{3} \tan \left (\frac {1}{2} \, e\right ) + \tan \left (\frac {1}{2} \, f x\right )^{2} \tan \left (\frac {1}{2} \, e\right )^{2} + \tan \left (\frac {1}{2} \, f x\right )^{2} + 2 \, \tan \left (\frac {1}{2} \, f x\right ) \tan \left (\frac {1}{2} \, e\right ) + \tan \left (\frac {1}{2} \, e\right )^{2}\right )}}{\tan \left (\frac {1}{2} \, e\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, e\right ) - c f}{a f^{2} \tan \left (\frac {1}{2} \, f x\right ) + a f^{2} \tan \left (\frac {1}{2} \, e\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)/(a-a*cos(f*x+e)),x, algorithm="giac")

[Out]

(d*f*x*tan(1/2*f*x)*tan(1/2*e) + c*f*tan(1/2*f*x)*tan(1/2*e) - d*f*x + d*log(4*(tan(1/2*f*x)^4 + 2*tan(1/2*f*x
)^3*tan(1/2*e) + tan(1/2*f*x)^2*tan(1/2*e)^2 + tan(1/2*f*x)^2 + 2*tan(1/2*f*x)*tan(1/2*e) + tan(1/2*e)^2)/(tan
(1/2*e)^2 + 1))*tan(1/2*f*x) + d*log(4*(tan(1/2*f*x)^4 + 2*tan(1/2*f*x)^3*tan(1/2*e) + tan(1/2*f*x)^2*tan(1/2*
e)^2 + tan(1/2*f*x)^2 + 2*tan(1/2*f*x)*tan(1/2*e) + tan(1/2*e)^2)/(tan(1/2*e)^2 + 1))*tan(1/2*e) - c*f)/(a*f^2
*tan(1/2*f*x) + a*f^2*tan(1/2*e))

________________________________________________________________________________________

Mupad [B]
time = 0.52, size = 65, normalized size = 1.30 \begin {gather*} \frac {2\,d\,\ln \left ({\mathrm {e}}^{e\,1{}\mathrm {i}}\,{\mathrm {e}}^{f\,x\,1{}\mathrm {i}}-1\right )}{a\,f^2}-\frac {\left (c+d\,x\right )\,2{}\mathrm {i}}{a\,f\,\left ({\mathrm {e}}^{e\,1{}\mathrm {i}+f\,x\,1{}\mathrm {i}}-1\right )}-\frac {d\,x\,2{}\mathrm {i}}{a\,f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c + d*x)/(a - a*cos(e + f*x)),x)

[Out]

(2*d*log(exp(e*1i)*exp(f*x*1i) - 1))/(a*f^2) - ((c + d*x)*2i)/(a*f*(exp(e*1i + f*x*1i) - 1)) - (d*x*2i)/(a*f)

________________________________________________________________________________________